package com.yowasa.xiuxian.engine.battle.buff;

import com.google.common.collect.Maps;
import com.yowasa.xiuxian.annoations.Buff;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.BuffContent;
import com.yowasa.xiuxian.entity.bo.battle.TempUserBattle;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;

import java.util.Map;

@Buff(name="雨帘剑")
public class YuLianJianBuff implements BuffInterface {

    @Override
    public void beforeBuffAction(UserBattleContent first, UserBattleContent second, BattleContent content) {

        int spell = (first.getBattleInfo().getHp()/20)*first.getBattleInfo().getRestoreRate()/100;
        first.getBattleInfo().setChp(first.getBattleInfo().getChp() + spell);
        BuffContent buffContent = first.getBuff().get("雨帘剑");
        if (buffContent.getNum() <= 1){
            buffContent.setDuration(1);
        }else {
            buffContent.setNum(buffContent.getNum() -1);
            first.getBuff().put("雨帘剑",buffContent);
        }
        content.getMsgLog().add(first.getUserBO().getName() + "因雨帘剑回复了" + spell + "点血");
    }

}
